package StudyCode.summary.mycollection;

import java.util.HashSet;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class GetIntersectionBetweenTwoHashSet {
	public static <T> HashSet<T> getIntersection(HashSet<T> set1,
	                                             HashSet<T> set2) {
		HashSet<T> set = new HashSet<T>();

		for (T elem : set1)
			if (set2.contains(elem))
				set.add(elem);
		return set;
	}

}

